<template>
	<view class="index-singleranksetting">
		<view class="index-singleranksetting-header">
			对另一半的要求
		</view>
		<scroll-view class="" scroll-y="true" style="height: 900rpx;">

			<view class="index-singleranksetting-main">
				<view class="index-singleranksetting-main-title">
					基本筛选
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						年龄
					</view>
					<view class="index-singleranksetting-main-item-content">
						<range-slider :blockSize="32" width="680" step="2" :values="ageRange" max="50" min="18"
							liveMode="true" @rangechange="onchangeAge"></range-slider>
						<view class="u-flex u-row-between">
							<view class="">
								{{ageRange[0]}}岁
							</view>
							<view class="">
								{{ageRange[1]}}岁
							</view>
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						身高
					</view>
					<view class="index-singleranksetting-main-item-content">
						<range-slider :blockSize="32" width="680" step="10" :values="tallRange" max="210" min="160"
							liveMode="true" @rangechange="onchangeTall"></range-slider>
						<view class="u-flex u-row-between">
							<view class="">
								{{tallRange[0]}}cm
							</view>
							<view class="">
								{{tallRange[1]}}cm
							</view>
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						学历
					</view>
					<view class="index-singleranksetting-main-item-content">
						<view class="index-singleranksetting-main-item-content-checkbox"
							:class="educationId==item.id?'act':''" v-for="(item,index) in educationList">
							{{item.value}}
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						婚姻状态
					</view>
					<view class="index-singleranksetting-main-item-content">
						<view class="index-singleranksetting-main-item-content-checkbox"
							:class="marryId==item.id?'act':''" v-for="(item,index) in marryList">
							{{item.value}}
						</view>
					</view>
				</view>
			</view>
			<view class="index-singleranksetting-main">
				<view class="index-singleranksetting-main-title u-flex u-row-between u-col-center">
					<view class="index-singleranksetting-main-title-content">
						高级筛选<image src="../../static/img/filter-vip.png" style="width: 80rpx;height: 32rpx;" mode="">
						</image>
					</view>
					<view class="index-singleranksetting-main-title-search" @click="jumpSearch()">
						<image src="../../static/img/filter-search.png" style="height: 40rpx;width: 40rpx;" mode="">
						</image>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						收入范围(年)
					</view>
					<view class="index-singleranksetting-main-item-content">
						<range-slider :blockSize="32" width="680" step="1" :values="payRange" max="180" min="1"
							liveMode="true" @rangechange="onchangePay"></range-slider>
						<view class="u-flex u-row-between">
							<view class="">
								{{payRange[0]}}W
							</view>
							<view class="">
								{{payRange[1]}}W
							</view>
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						家乡
					</view>
					<view class="index-singleranksetting-main-item-content">
						<view class="index-singleranksetting-main-item-content-checkbox"
							:class="homelandId==item.id?'act':''" v-for="(item,index) in homelandList">
							{{item.value}}
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						学校偏好（可多选）
					</view>
					<view class="index-singleranksetting-main-item-content">
						<view class="index-singleranksetting-main-item-content-checkbox"
							:class="schoolId==item.id?'act':''" v-for="(item,index) in schoolList">
							{{item.value}}
						</view>
					</view>
				</view>
				<view class="index-singleranksetting-main-item">
					<view class="index-singleranksetting-main-item-title">
						个人标签
					</view>
					<view class="index-singleranksetting-main-item-content">
						<view class="index-singleranksetting-main-item-content-checkbox"
							:class="personalId==item.id?'act':''" v-for="(item,index) in personalList">
							{{item.value}}
						</view>
					</view>
				</view>
			</view>
			<view class="index-singleranksetting-btn">
				<view class="index-singleranksetting-btn-item public-btn public-btn-color">
					确认
				</view>
				<view class="index-singleranksetting-btn-item public-btn">
					重置
				</view>
			</view>
		</scroll-view>
		<u-popup v-model="vipShow" mode="center" border-radius="20">
			<indexSingleranksettingVip></indexSingleranksettingVip>
		</u-popup>
	</view>
</template>

<script>
	//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
	import rangeSlider from '../../ex-components/range-slider/range-slider.vue'
	import indexSingleranksettingVip from '../index-singleranksetting-vip/index-singleranksetting-vip.vue'
	export default {
		// 组件名称
		name: 'demo',
		// 组件参数 接收来自父组件的数据
		props: {},
		// 局部注册的组件,import引入的组件需要注入到对象中才能使用
		components: {
			rangeSlider,
			indexSingleranksettingVip
		},
		// 组件状态值
		data() {
			return {
				vipShow: false,
				ageRange: [18, 30],
				tallRange: [150, 190],
				payRange: [1, 50],
				educationId: 0,
				educationList: [{
					id: 0,
					value: '不限'
				}, {
					id: 1,
					value: '大专及以上'
				}, {
					id: 2,
					value: '本科及以上'
				}, {
					id: 3,
					value: '硕士及以上'
				}, {
					id: 4,
					value: '博士'
				}, ],
				marryId: 0,
				marryList: [{
					id: 0,
					value: '均可'
				}, {
					id: 1,
					value: '仅接受未婚'
				}, {
					id: 2,
					value: '仅接受离异'
				}],
				homelandId: 0,
				homelandList: [{
					id: 0,
					value: '不限'
				}, {
					id: 1,
					value: '山东省'
				}],
				schoolId: 0,
				schoolList: [{
					id: 0,
					value: '不限'
				}, {
					id: 1,
					value: '一本以上'
				}, {
					id: 2,
					value: '985/211'
				}, {
					id: 3,
					value: '世界知名名校'
				}, {
					id: 4,
					value: '海归'
				}, {
					id: 5,
					value: '艺术体育类'
				}, ],
				personalId: 0,
				personalList: [{
					id: 0,
					value: '不限'
				}, {
					id: 1,
					value: '标签'
				}],
			}
		},
		// 计算属性
		computed: {},
		// 侦听器
		watch: {},
		// 组件方法
		methods: {
			onchangePay(e) {
				this.payRange = [e.minValue, e.maxValue];
			},
			onchangeTall(e) {
				this.tallRange = [e.minValue, e.maxValue];
			},
			onchangeAge(e) {
				this.ageRange = [e.minValue, e.maxValue];
			},
			jumpSearch() {
				// this.vipShow = true
				this.$Router.push({
					path: '/pages/index/index/index-vipsearch',
				})
			}
		},
		// 以下是生命周期钩子   注：没用到的钩子请自行删除
		/**
		 * 在实例初始化之后，组件属性计算之前，如data属性等
		 */
		beforeCreate() {},
		/**
		 * 组件实例创建完成，属性已绑定，但DOM还未生成，$ el属性还不存在
		 */
		created() {},
		/**
		 * 在挂载开始之前被调用：相关的 render 函数首次被调用。
		 */
		beforeMount() {},
		/**
		 * el 被新创建的 vm.$ el 替换，并挂载到实例上去之后调用该钩子。
		 * 如果 root 实例挂载了一个文档内元素，当 mounted 被调用时 vm.$ el 也在文档内。
		 */
		mounted() {},
		/**
		 * 数据更新时调用，发生在虚拟 DOM 重新渲染和打补丁之前。
		 * 你可以在这个钩子中进一步地更改状态，这不会触发附加的重渲染过程。
		 */
		beforeUpdate() {},
		/**
		 * 由于数据更改导致的虚拟 DOM 重新渲染和打补丁，在这之后会调用该钩子。
		 * 当这个钩子被调用时，组件 DOM 已经更新，所以你现在可以执行依赖于 DOM 的操作。
		 */
		updated() {},
		/**
		 * keep-alive 组件激活时调用。 仅针对keep-alive 组件有效
		 */
		activated() {},
		/**
		 * keep-alive 组件停用时调用。 仅针对keep-alive 组件有效
		 */
		deactivated() {},
		/**
		 * 实例销毁之前调用。在这一步，实例仍然完全可用。
		 */
		beforeDestroy() {},
		/**
		 * Vue 实例销毁后调用。调用后，Vue 实例指示的所有东西都会解绑定，
		 * 所有的事件监听器会被移除，所有的子实例也会被销毁。
		 */
		destroyed() {}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<!--使用了scoped属性之后，父组件的style样式将不会渗透到子组件中，-->
<!--然而子组件的根节点元素会同时被设置了scoped的父css样式和设置了scoped的子css样式影响，-->
<style scoped lang="scss">
	.index-singleranksetting {
		padding: 0 32rpx;

		&-header {
			font-size: 28rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			color: #2E3033;
			font-weight: 600;
			margin-top: 40rpx;
			text-align: center;
		}

		&-main {
			&-title {
				font-size: 28rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #2E3033;
				margin-bottom: 40rpx;
			}

			&-item {
				margin-bottom: 60rpx;

				&-title {
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					color: #5C5F66;
				}

				&-content {
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #5C5F66;

					&-checkbox {
						display: inline-block;
						min-width: 100rpx;
						line-height: 56rpx;
						margin-right: 20rpx;
						margin-top: 20rpx;
						padding: 0 20rpx;
						height: 56rpx;
						background: #F5F5F5;
						border-radius: 8rpx 8rpx 8rpx 8rpx;
						color: #737780FF;
						font-size: 24rpx;
						font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						text-align: center;
					}
				}

				.act {
					background: #7266FF;
					color: #fff;
				}
			}
		}

		&-btn {
			&-item {
				margin: 0 auto;
				margin-bottom: 40rpx;
			}
		}
	}
</style>
